package me.bcloud.web.util;

import java.nio.charset.Charset;
import java.util.List;


import me.bcloud.web.domain.User;

public class Tools {

	public static byte[] usersToStr(List<User> users) {
		/**
		 * json处理方式 太占用带宽
		 */
		//return JSONArray.fromObject(users).toString();
		
		StringBuilder sb=new StringBuilder();
		for (User user : users) {
			sb.append(user.getId() + ",");
			sb.append((user.getUserid()=="null"?"":user.getUserid()) + ",");
			
			sb.append((user.getPassword()=="null"?"":user.getPassword()) + ",");
			
			sb.append((user.getIdcard()==null?"":user.getIdcard()) + ",");
			sb.append((user.getMobile()==null?"":user.getMobile()) + ",");
			sb.append((user.getBirthday()==null?"":user.getBirthday()) + ",");
			sb.append((user.getEmail()==null?"":user.getEmail()) + "|");
		
		}
		return sb.toString().getBytes(Charset.forName("utf-8"));
	}
}
